﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="XompareConfigSection.cs" company="" />
// </copyright>
// <summary>
//   The configuration set of the Xompare application.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Xompare.Configuration
{
    using System.Configuration;

    /// <summary>
    /// The configuration set of the Xompare application.
    /// </summary>
    public class XompareConfigSection : ConfigurationSection
    {
        #region Configuration field names

        private const string c_defaultKey = "defaultKey";
        private const string c_knownExtensions = "KnownExtensions";

        #endregion

        public const string SectionName = "XompareApplication";

        #region Configuration fields

        /// <summary>
        /// Gets or sets the value of the default key in case it is not defined for a given file extension.
        /// </summary>
        [ConfigurationProperty(c_defaultKey, IsRequired = true, DefaultValue = null)]
        public string DefaultKey
        {
            get
            {
                return (string)this[c_defaultKey];
            }

            set
            {
                this[c_defaultKey] = value;
            }
        }

        /// <summary>
        /// Gets the configured file patterns and behaviors.
        /// </summary>
        [ConfigurationProperty(c_knownExtensions, IsRequired = false)]
        public KnownExtensionsConfigCollection KnownExtensions
        {
            get
            {
                return (KnownExtensionsConfigCollection)this[c_knownExtensions];
            }
        }

        /// <summary>
        /// Gets or sets the configuration of the GUI.
        /// </summary>
        [ConfigurationProperty(GuiDefinitionConfigElement.CElementName, IsRequired = true)]
        public GuiDefinitionConfigElement GuiDefinitionConfig
        {
            get
            {
                return (GuiDefinitionConfigElement)this[GuiDefinitionConfigElement.CElementName];
            }

            set
            {
                this[GuiDefinitionConfigElement.CElementName] = value;
            }
        }

        #endregion
    }
}
